package com.example.demo.demos.example;

import com.example.demo.demos.pojo.User;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * @author lyh
 * @date 2025/4/16 9:45
 */
public class NullPointerAssert {
    public static void main(String[] args) {
        User user1 = new User();
        User user2 = new User();
        User user3 = new User();
        List<User> users = new ArrayList<User>();
        Optional.ofNullable(user1).ifPresent(user -> users.add(user));
    }
}
